---
interface Component {
  dark: boolean
}

interface Props {
  components: Component[]
}

const { components } = Astro.props

const count = components.reduce((total: number, component: Component) => {
  if (component.dark) {
    return total + 2
  }

  return total + 1
}, 0)
---

<span>
  {count} components
</span>
